<template>
	<view class="container">
		<b-u-button-red @click="show = !show">{{$t("语言")}}</b-u-button-red>
		
		<u-select v-model="show" :list="locales" @confirm="onLocaleChange"></u-select>
		
	</view>
</template>

<script>
	export default {
		computed: {
			locales() {
				return [
					{
						label: '中文简体',
						value: 'zh-Hans'
					},
					{
						label: '中文繁體',
						value: 'zh-Hant'
					},
					{
						label: 'English',
						value: 'en'
					},
				]
			}
		},
		data() {
			return {
				show: false,
			}
		},
		onLoad() {
			uni.setNavigationBarTitle({
				title: this.$t("语言"),
			})
		},
		methods: {
			onLocaleChange(e) {
				uni.setLocale(e[0].value);
				this.$i18n.locale = e[0].value;
				uni.setNavigationBarTitle({
					title: this.$t("语言"),
				})
			},
			getHttp() {

			},
		},
	}
</script>

<style lang="scss" scoped>
	.container {}
</style>